﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ModelQuality.Metrics.Rules
{
    partial class Activity
    {
        public IList<ValidationRule> GetAllRootRules()
        {
            var elts = elementRule ?? new ElementRule[0];
            var assocs = associationRule ?? new AssociationRule[0];
            var diags = diagramRule ?? new DiagramRule[0];
            
            return elts.Cast<ValidationRule>()
                    .Union(assocs)
                    .Union(diags)
                    .ToList().AsReadOnly();
        }

        public void ResetRules()
        {
            GetAllRootRules().ToList().ForEach(rule => rule.Reset());
        }
    }
}
